package com.kedi.welfarecenter.service.operationcenter.impl;

import com.kedi.welfarecenter.read.dao.mapper.TemporaryBenefitMapper;
import com.kedi.welfarecenter.service.operationcenter.TemporaryBenefitService;
import com.kedi.welfarecenter.write.dao.mapper.WriteTemporaryBenefitMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
* @Description:    临时性福利
* @Author:         ytw
* @CreateDate:     2019/7/23 16:04
* @UpdateRemark:   修改内容
* @Version:        1.0
*/
@Service
public class TemporaryBenefitServiceImpl implements TemporaryBenefitService {
    @Autowired
    TemporaryBenefitMapper temporaryBenefitMapper;

    @Autowired
    WriteTemporaryBenefitMapper writeTemporaryBenefitMapper;
    /**
     * 方法实现说明  查找所有临时性福利
     * @author      ytw
     *@param
     * @return
     * @exception
     * @date        2019/7/26 9:28
     */
    @Override
    public List<Map<String, Object>> selectcps() {
        return temporaryBenefitMapper.selectcps();
    }
    /**
     * 方法实现说明  搜索框  根据机构名查找
     * @author      ytw
     *@param         welfaretitle
     * @return
     * @exception
     * @date        2019/7/26 9:28
     */
    @Override
    public List<Map<String, Object>> selectcpsByName(String welfaretitle) {
        return temporaryBenefitMapper.selectcpsByName(welfaretitle);
    }

    /**
     * 方法实现说明  根据福利表主键id 查找详情
     * @author      ytw
     *@param         welfareId
     * @return
     * @exception
     * @date        2019/7/26 9:29
     */
    @Override
    public List<Map<String, Object>> selectcpsDetails(Integer welfareId) {
        return temporaryBenefitMapper.selectcpsDetails(welfareId);
    }

    /**
     * 方法实现说明  发送电话
     * @author      ytw
     *@param         welfarereceiverid
     * @return
     * @exception
     * @date        2019/7/26 9:29
     */
    @Override
    public Map<String, Object> selectcpsPhone(Integer welfarereceiverid) {
        return temporaryBenefitMapper.selectcpsPhone(welfarereceiverid);
    }

    /**
     * 方法实现说明  新增临时性福利
     * @author      ytw
     *@param     welfaretitle,lowage,heighage,name,price,givetime
     * @return
     * @exception
     * @date        2019/7/26 9:30
     */
    @Transactional(rollbackFor=Exception.class)
    @Override
    public Integer createcps(String welfaretitle, Integer lowage, Integer heighage, String name, Integer price, String givetime) {
        return writeTemporaryBenefitMapper.createcps(welfaretitle,lowage,heighage,name,price,givetime);
    }

    /**
     * 方法实现说明  修改临时性福利
     * @author      ytw
     *@param         welfaretitle,lowage,heighage,name,price,givetime,welfareid
     * @return
     * @exception
     * @date        2019/7/26 9:30
     */
    @Transactional(rollbackFor=Exception.class)
    @Override
    public Integer updatecps(String welfaretitle, Integer lowage, Integer heighage, String name, Integer price, String givetime, Integer welfareid) {
        return writeTemporaryBenefitMapper.updatecps(welfaretitle,lowage,heighage,name,price,givetime,welfareid);
    }
}
